package com.canbot.u05.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

        private static final int VERSION = 1;

        private static final String TAG = "DatabaseHelper";

        public DatabaseHelper(Context context, String name, CursorFactory factory,
                              int version) {
                super(context, name, factory, version);

        }

        public DatabaseHelper(Context context, String name) {
                this(context, name, VERSION);
        }

        public DatabaseHelper(Context context, String name, int version) {
                this(context, name, null, version);
        }

        public void onCreate(SQLiteDatabase db) {
                Log.i(TAG, "创建数据库");
                String sql = "create table custom_dialogue(_id integer primary key autoincrement,question varchar(50),answer varchar(50),type integer)";
                db.execSQL(sql);
                String sql2 = "create table face_data(_id integer primary key autoincrement,name varchar(30),sex varchar(30),voicetype integer,content varchar(30),identification varchar(50),photoLibPath varchar(50))";
                // 执行创建数据库操作
                db.execSQL(sql2);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
                Log.i(TAG, "创建成功!!");
        }
}
